<script setup>
import Aside from './Aside.vue';
import Header from './Header.vue';
import { useCollapseStore } from '@/stores/collapse.js'
import { storeToRefs } from 'pinia'
import { ref, computed } from 'vue'
import { useRoute } from 'vue-router';

const collapseStore = useCollapseStore()
const { isCollapse } = storeToRefs(collapseStore)
const collapseWidth = computed(() => isCollapse.value ? '64px' : '250px')

const route = useRoute()
// console.log(route)
</script>

<template>
  <div class="common-layout container">
    <el-container>
      <el-aside :width="collapseWidth"><Aside /></el-aside>
      <el-container>
        <el-header height="90px"><Header /></el-header>
        <el-main>
          <!-- <router-view /> -->
          <router-view v-if="route.fullPath" />
          <div v-if="route.fullPath === '/'" class="default-main">
            <el-card style="max-width: 480px">
              <template #header><div class="card-header"><span>卡片头</span></div></template>
              <p v-for="o in 4" :key="o" class="text item">{{ 'List item ' + o }}</p>
              <template #footer>卡片FOOTER</template>
            </el-card>
          </div>
        </el-main>
        <!-- <el-main>main</el-main> -->
      </el-container>
    </el-container>
  </div>
</template>

<style scoped>
.el-container{
  width: 100vw;
  height: 100vh;
}
.el-aside{
  background-color: #e6e6e6;
}
.el-header{
  background-color: #f4f3f2;
}
.el-main{
  background-color: rgba(50, 171, 157, 0.889);
}
</style>